Security News
NIST Misses 2024 Deadline to Clear NVD Backlog
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
prepend-http
Advanced tools
The prepend-http npm package is a utility that ensures a URL has a protocol (http or https) prepended to it. This is useful for normalizing URLs and ensuring they are valid for HTTP requests.
Prepend HTTP to URL
This feature allows you to prepend 'http://' to a URL if it does not already have a protocol. This is useful for ensuring that URLs are valid for HTTP requests.
const prependHttp = require('prepend-http');
const url = 'example.com';
const fullUrl = prependHttp(url);
console.log(fullUrl); // 'http://example.com'
Prepend HTTPS to URL
This feature allows you to prepend 'https://' to a URL if it does not already have a protocol. This is useful for ensuring that URLs are secure.
const prependHttp = require('prepend-http');
const url = 'example.com';
const fullUrl = prependHttp(url, {https: true});
console.log(fullUrl); // 'https://example.com'
The normalize-url package is a more comprehensive solution for URL normalization. It not only ensures that a URL has a protocol, but also handles other aspects of URL normalization such as removing duplicate slashes, sorting query parameters, and more. It is more feature-rich compared to prepend-http.
The url-parse package is a robust URL parsing library that can handle a wide range of URL manipulations, including ensuring that a URL has a protocol. It provides more extensive parsing and manipulation capabilities compared to prepend-http.
Prepend
http://
to humanized URLs liketodomvc.com
andlocalhost
$ npm install --save prepend-http
const prependHttp = require('prepend-http');
prependHttp('todomvc.com');
//=> 'http://todomvc.com'
prependHttp('localhost');
//=> 'http://localhost'
prependHttp('http://todomvc.com');
//=> 'http://todomvc.com'
MIT © Sindre Sorhus
FAQs
Prepend `https://` to humanized URLs like sindresorhus.com and localhost
The npm package prepend-http receives a total of 8,139,893 weekly downloads. As such, prepend-http popularity was classified as popular.
We found that prepend-http demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.